using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class creature_template_addon : MangosBase
	{
		public System.UInt32? entry;
		public System.UInt32? mount;
		public System.UInt32? bytes1;
		public System.UInt32? bytes2;
		public System.UInt32? emote;
		public System.UInt32? moveflags;
		public System.String auras;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `emote`, `moveflags`, `auras`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}');", entry.GetValueOrDefault(), mount.GetValueOrDefault(), bytes1.GetValueOrDefault(), bytes2.GetValueOrDefault(), emote.GetValueOrDefault(), moveflags.GetValueOrDefault(), auras.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `creature_template_addon` SET ");
			if(mount != null)
			{
				sb.AppendLine("`mount`='" + mount.Value.ToString() + "'");
			}
			if(bytes1 != null)
			{
				sb.AppendLine("`bytes1`='" + bytes1.Value.ToString() + "'");
			}
			if(bytes2 != null)
			{
				sb.AppendLine("`bytes2`='" + bytes2.Value.ToString() + "'");
			}
			if(emote != null)
			{
				sb.AppendLine("`emote`='" + emote.Value.ToString() + "'");
			}
			if(moveflags != null)
			{
				sb.AppendLine("`moveflags`='" + moveflags.Value.ToString() + "'");
			}
			if(auras != null)
			{
				sb.AppendLine("`auras`='" + auras.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
